

import psutil,time,os,requests
from manage.exception import Exceptions
from base_config import *

def checkProc():

    # 请求任务接口

    data = {

        'sign':'67c067891a0425c63cc282478f336776'
    }

    url = domain_url['domain']['test_task_url']

    r = requests.post(url=url, data=data)

    # 暂无领取任务
    if r.status_code == 200 and r.json()['code'] == 102:

        print('*------------------------任务全部完成睡眠60s再次发起请求，当前时间:%s--------------------------*'%(time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(time.time()))))

        time.sleep(60)

    else:

        # 获取进程列表
        procList = [ proc.as_dict(attrs=['pid', 'name'])['name'] for proc in psutil.process_iter()]

        if '拼多多站外工具.exe' in procList:

            pass

        else:

            Exceptions.resetConnet()

            os.system(r'D:\拼多多站外工具箱\dist\拼多多站外工具.exe')


if __name__ == '__main__':

    # while True:
    #
    #     checkProc()
    #
    #     time.sleep(2)

    pass



os.system(r'D:\拼多多站外工具箱\dist\拼多多站外工具.exe')


